﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>操作按钮表单</title>
    <link href="/Themes/Styles/style.css" rel="stylesheet" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/artDialog.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/iframeTools.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script>
        $(function () {
            if (IsNullOrEmpty(GetQuery('key'))) {
                InitControl()
            }
        })
        //选取系统图标
        function SelectOpenImg() {
            var url = "/Module/ModuleIcon?Size=16";
            top.openDialog(url, 'ModuleIcon', '选取系统图标', 615, 530, 100, 50);
        }
        //选取系统图标，回调
        function Set_Menu_Img(img) {
            $("#Img_Menu_Img").attr("src", '/Themes/Images/16/' + img);
            $("#Img").val(img);
        }
        //保存事件
        function AcceptClick() {
            if (!CheckDataValid('#form1')) {
                return false;
            }
            var postData = GetWebControls("#form1");
            getAjax("/Button/AcceptClick?key=" + GetQuery('key'), postData, function (data) {
                if (IsNullOrEmpty(GetQuery('key'))) {
                    if (data) { AlertCallback("恭喜您，更新成功。"); return false; }
                } else {
                    if (data) { AlertCallback("恭喜您，新增成功。"); return false; }
                }
                if (!data) {
                    Alert_Error("很抱歉，操作失败。"); return false;
                } else {
                    Alert_Wern(data); return false;
                }
            });
        }
        //得到一个对象实体
        function InitControl() {
            getAjax("/Button/InitControl", { key: GetQuery('key') }, function (data) {
                var data = eval("(" + data + ")");
                SetWebControls(data);
                if (data.Img != "") {
                    $("#Img_Menu_Img").attr("src","/Themes/Images/16/" + data.Img)
                }
            });
        }
    </script>
</head>
<body>
    <form id="form1">
        <table border="0" cellpadding="0" cellspacing="0" class="frm">
            <tr>
                <th>按钮编码[<font face="宋体">*</font>]：
                </th>
                <td>
                    <input id="Control_ID" maxlength="50" type="text" datacol="yes" err="按钮编码" checkexpession="NotNull" class="txt" style="width: 90%" />
                </td>
            </tr>
            <tr>
                <th>按钮名称[<font face="宋体">*</font>]：
                </th>
                <td>
                    <input id="FullName" maxlength="50" type="text" class="txt" datacol="yes" err="按钮名称" checkexpession="NotNull" style="width: 90%" />
                </td>
            </tr>
            <tr>
                <th>按钮图标：
                </th>
                <td>
                    <input id="Img" type="hidden" />
                    <img id="Img_Menu_Img" src="/Themes/Images/illustration.png" alt=""
                        style="vertical-align: middle; padding-right: 10px; width: 16px; height: 16px;" />
                    <input class="btn" value="图标选取" type="button" onclick="SelectOpenImg();" />
                </td>
            </tr>
            <tr>
                <th>按钮事件：
                </th>
                <td>
                    <input id="Event" maxlength="200" type="text" class="txt" style="width: 90%" />
                </td>
            </tr>
            <tr>
                <th>按钮分类：
                </th>
                <td>
                    <select id="Category" class="select" style="width: 90%">
                        <option value="工具栏">工具栏</option>
                        <option value="右击菜单栏">右击菜单栏</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th>选项：
                </th>
                <td>
                    <span class="item">
                        <input id="Enabled" type="checkbox" checked="checked" style="vertical-align: middle;" />
                        <label for="Enabled" style="vertical-align: middle;">有效</label>
                        &nbsp;&nbsp;
                    </span>
                    <span class="item">
                        <input id="Split" type="checkbox" checked="checked" style="vertical-align: middle;" />
                        <label for="Split" style="vertical-align: middle;">分开</label>
                        &nbsp;&nbsp;
                    </span>
                </td>
            </tr>
            <tr>
                <th>显示顺序[<font face="宋体">*</font>]：
                </th>
                <td>
                    <input id="SortCode" type="text" class="txt" datacol="yes" err="显示顺序"
                        checkexpession="Num" style="width: 90%" />
                </td>
            </tr>
            <tr>
                <th>描述：
                </th>
                <td>
                    <input id="Description" maxlength="200" type="text" class="txt" style="width: 90%" />
                </td>
            </tr>
        </table>
        <div class="frmbottom">
            <a id="Accept" class="l-btn" href="javascript:void(0)" onclick="AcceptClick();"><span class="l-btn-left">
                <img src="/Themes/Images/16/accept.png" alt="" />确 认</span></a>

            <a class="l-btn" href="javascript:void(0)" onclick="OpenClose();"><span class="l-btn-left">
                <img src="/Themes/Images/16/cancel.png" alt="" />关 闭</span></a>
        </div>
    </form>
</body>
</html>
